package com.xposed.xposedinit

import android.annotation.SuppressLint
import android.content.Context
import android.os.Bundle
import android.telephony.TelephonyManager
import android.widget.Button
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import de.robv.android.xposed.XposedBridge

class MainActivity : AppCompatActivity() {
    @SuppressLint("HardwareIds")
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        var btn = findViewById<Button>(R.id.btn)
        btn.setOnClickListener {
            if (!isModuleActive()) {
                Toast.makeText(this, "模块未启动", Toast.LENGTH_LONG).show();
            } else {
                Toast.makeText(this, "模块已启动", Toast.LENGTH_LONG).show();
            }

            val telephonyManager =
                this.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager
            val imei = telephonyManager.deviceId
            Toast.makeText(this, "${imei}", Toast.LENGTH_LONG).show();
        }
    }

    private fun isModuleActive(): Boolean {
        XposedBridge.log("Loaded app:  isModuleActive");
        return false
    }

}